{include file="public/head"}
    <body>
    <div class="x-body" >
        <button class="layui-btn layui-btn-small " onclick="x_admin_show('添加菜单','showAdd.html',500,460)"></i>添加菜单</button>
        <button onclick="javascript:location.reload()" class="layui-btn layui-btn-small">刷新</button>
        <span class="x-right" style="line-height:40px">共有数据:10条</span>

    <table class="layui-table">
        <thead>
          <tr>
            <th>ID</th>
            <th>权限名称</th>
            <th>控制器方法</th>
            <th>图标</th>
            <th>状态</th>
            <th>操作</th>
        </thead>
        <tbody>
                          {volist name='auth' id='vo'}
                            <tr>
                                <td>{$vo.id}</td>
                                <td>&nbsp;{$vo.level-1|str_repeat='&nbsp;丨---',###}{$vo.title}</td>
                                <td>{$vo.name}</td>
                                <td>
                                    <i class="layui-icon">{eq name="$vo.icon" value=""}未设置{else/}{$vo['icon']}{/eq}</i>   
                                </td>
                                <td>{eq name='vo.status' value='1'}显示{else/}<font color="red">隐藏</font>{/eq}
                                </td>
                                <td>
                                    <button type="button" onclick="x_admin_show('编辑菜单',
                                    'showEdit.html?id={$vo.id}',500,460)" class="layui-btn layui-btn-mini">编辑
                                    </button>
                                    <button type="button" onClick="deleteAuthRule({$vo.id})" class="layui-btn layui-btn-mini layui-btn-danger">删除</button>
                                </td>
                            </tr>
                            {/volist}
        </tbody>
      </table>
	      <div class="page">
	        <div>
	        
	        </div>
	      </div>
    </div>
</body>
<script>
function deleteAuthRule(id){
    layer.confirm('确定要删除吗?',{
          btn: ['确定','取消'] //按钮
        }, function(){
            $.ajax({
                url: 'delete',
                type: 'post',
                dataType: 'json',
                data: {id:id},
            })
            .done(function(data){
                console.log(data);
                if(data.code==0){
                    layer.msg(data.msg,{icon:5,time:1000});
                }else{
                    layer.msg(data.msg,{icon:1,time:1000},function(){
                        window.location.reload();
                    })
                }
            })
        });
}
</script>
{include file="public/foot"}